import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/data/entities/application/securtity_base_drawer.dart';
import 'package:enterprise_v6_app/app/modules/application/standardization/home/home_view.dart';
import 'package:enterprise_v6_app/app/modules/application/standardization/pages/chemistry/pages_view.dart';
import 'package:enterprise_v6_app/app/modules/application/standardization/pages/edu/pages_view.dart';
import 'package:enterprise_v6_app/app/modules/application/standardization/pages/improve/pages_view.dart';
import 'package:enterprise_v6_app/app/modules/application/standardization/pages/regulation/pages_view.dart';
import 'package:enterprise_v6_app/app/modules/application/standardization/pages/risk/pages_view.dart';
import 'package:enterprise_v6_app/app/modules/application/standardization/pages/scence/pages_view.dart';
import 'package:enterprise_v6_app/app/modules/application/standardization/pages/target/pages_view.dart';
import 'package:enterprise_v6_app/app/modules/application/standardization/pages/urgent/pages_view.dart';

class StandardizationController extends GetxController {
  /// scaffoldKey
  final scaffoldKey = GlobalKey<ScaffoldState>();

  /// 选中的页面
  int selectIndex = 0;

  final titleList = [
    SecurityBaseEntity(
      title: '总览',
      icon: AppImages.icon_inspection_drawer_4,
      expandTitle: '总览',
      currentPageTitle: 0,
      pages: [StandardizationHomeView()],
    ),
    SecurityBaseEntity(
      title: '目标职责',
      icon: AppImages.icon_left_tab_target,
      expandTitle: '目标职责',
      currentPageTitle: 0,
      pages: [StandardizationTargetView()],
    ),
    SecurityBaseEntity(
      title: '制度化管理',
      icon: AppImages.icon_left_tab_list,
      expandTitle: '制度化管理',
      currentPageTitle: 0,
      pages: [const StandardizationRegulationView()],
    ),
    SecurityBaseEntity(
      title: '教育培训',
      icon: AppImages.icon_left_tab_book,
      expandTitle: '教育培训',
      currentPageTitle: 0,
      pages: [StandardizationEduView()],
    ),
    SecurityBaseEntity(
      title: '现场管理',
      icon: AppImages.icon_left_tab_ring_dot,
      expandTitle: '现场管理',
      currentPageTitle: 0,
      pages: [StandardizationScenceView()],
    ),
    SecurityBaseEntity(
      title: '风险管控',
      icon: AppImages.icon_left_tab_alarm,
      expandTitle: '风险管控',
      currentPageTitle: 0,
      pages: [StandardizationRiskView()],
    ),
    SecurityBaseEntity(
      title: '应急管理',
      icon: AppImages.icon_left_tab_urgent,
      expandTitle: '应急管理',
      currentPageTitle: 0,
      pages: [StandardizationUrgentView()],
    ),
    SecurityBaseEntity(
      title: '危险化学品',
      icon: AppImages.icon_left_tab_chemistry,
      expandTitle: '危险化学品',
      currentPageTitle: 0,
      pages: [StandardizationChemistryView()],
    ),
    SecurityBaseEntity(
      title: '持续改进',
      icon: AppImages.icon_left_tab_edit,
      expandTitle: '持续改进',
      currentPageTitle: 0,
      pages: [StandardizationImproveView()],
    ),
  ];

  /// title选择切换
  /// [titleIndex] 标题索引
  /// [index] 页面索引
  void selectTitle(int titleIndex, int index) {
    titleList[titleIndex].currentPageTitle = index;
    update();
  }

  /// 点击左侧菜单
  /// [index] 索引
  void selectLeftMenu(int index) {
    selectIndex = index;
    update();
  }

  /// 点击展开菜单
  /// [index] 索引
  void selectExpandMenu(int index) {
    selectIndex = index;
    Get.back();
    update();
  }
}
